#include <sys/ioctl.h>

#include "data_models.h"

enum ColorStyle{
    Comment = 36,
    Keyword2 = 33,
    Keyword1 = 32,
    String = 35,
    Number = 31,
    Match = 34,
    Default = 0,
    Invert = 7,
};


class Terminal{
public:
    Terminal();
    ~Terminal();

    TerminalSize Size();
    void ClearScreen();
    void CursorPosition(Position position);
    void CursorHide();
    void CursorShow();
    void ClearCurrentLine();
    void Flush();
    void SetStyle(int style);
    void ResetStyle();

private:
    TerminalSize _size;
    int getWindowSize(int ifd,int ofd,int *rows,int *cols);
    int getCursorPosition(int ifd, int ofd, int *rows, int *cols);
    int getCursorPosLen(unsigned x,unsigned t);
    void setCursorPosStr(char* buffer,unsigned x,unsigned t);
    int numlen(int num);
};

